package com.geektime.hello.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @Author: DRevelation
 * @Date: 2021/3/2 9:33
 */
@RestController
@RequestMapping("req")
public class ReqController {

    @Resource
    private HttpServletRequest request;

    @GetMapping("userAgent")
    public String getUserAgent(HttpServletRequest request) {
        return request.getHeader("user-agent");
    }

    @GetMapping("userAgent2")
    public String getUserAgent2() {
        return request.getHeader("user-agent");
    }

}
